import pathway as pw
from application.db.mysql_db.info.ResourceInformationList import ResourceInformationList


class InformationDeduplicationPipeline:
    all_ids = ResourceInformationList.select(ResourceInformationList.information_id)

    def apply(self, value):
        result = value.with_columns(
            is_excluded=pw.apply(
                self.exclude_uid_list,
                value.uid
            )
        )
        return result

    def exclude_uid_list(self, uid: str) -> bool:
        return uid in self.all_ids
